#pragma once
template <class Iterator, class Ref, class Ptr>
struct ReverseIterator
{
	typedef ReverseIterator<Iterator, Ref, Ptr> self;
	Iterator _it;

	ReverseIterator(Iterator it)
		:_it(it)
	{}
	self& operator++()
	{
		--_it;
		return *this;
	}
	self& operator++(int)
	{
		self tmp = *this;
		--_it;
		return tmp;
	}
	self& operator--()
	{
		_it++;
		return *this;
	}
	self& operator--(int)
	{
		self tmp = *this;
		_it++;
		return tmp;
	}
	Ref operator* ()
	{
		return *_it;
	}
	Ptr operator-> ()
	{
		return _it.operator ->();
	}
	bool operator!= (const self& s)
	{
		return _it != s._it;
	}
};